<template>
  <div>
    <ul class="mui-table-view">
      <li class="mui-table-view-cell mui-media" v-for="item in piclist" :key="item.pid">
        <router-link :to="'/home/newsinfo/'+item.pid">
          <img class="mui-media-object mui-pull-left"  :src="item.picname"/>
          <div class="mui-media-body">
            <h1>{{ item.picinfo }}</h1>
            <p class="mui-ellipsis">
              <span>发表时间：{{ item.picdate | dateFormat}}</span>
              <span>点击：{{ item.like }}次</span>
            </p>
          </div>
        </router-link>        
      </li>
    </ul>
  </div>
</template>
<script>
import { Toast } from 'mint-ui'
export default {
    data() {
        return {
            piclist:[],

        }
    },
    created() {
        this.getNewslist();
    },
    methods: { 
        //获取数据   
        getNewslist(){
            let _this = this;
            this.axios
            .get("postpic/piclist")
            .then((res)=>{
                //  console.log(res.data.massage);
               if(res.data.success==1){
                // 成功回调
                   res.data.massage.map((item)=>{
                       _this.piclist.push(item);
                    //    console.log(item.picname)
                   })               
               }else{
                    Toast('加载失败')
                }
            })
            .catch((res)=>{

            })
        }
    },
};
</script>
<style lang="scss" scoped>
.mui-media-body {
  h1 {
    font-size: 14px;
  }
  .mui-ellipsis {
    color: #26a2ff;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
  }
}
</style>